<template>
  <div class="ele-evaluate-container">
    <!-- 组 需要传入数组信息 -->
    <div class="ele-evaluate-item" v-for="(value, index) in dataList">
      <div class="header-img">
        <img :src="value.avatar" alt="" @load="imgLoad" />
      </div>
      <div class="ele-eval-content">
        <div class="username">
          {{ value.username }}
          <span v-if="value.deliveryTime" class="deliveryTime"
            >{{ value.deliveryTime }}分钟送达</span
          >
          <span class="publish-time" style="float:right">
            {{ value.rateTime | dateFormat }}
          </span>
        </div>
        <div class="user-star">
          <ele-star :score="value.score" />
        </div>
        <div class="user-commend-text">
          <p>{{ value.text }}</p>
        </div>
        <!-- 评价标签 -->
        <div class="user-commend-tag">
          <ele-commend-icon :value="value.rateType" />
          <div class="commend-tag" v-if="value.recommend">
            <span v-for="value1 in value.recommend">{{ value1 }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import eleStar from "@/components/stars.vue";
import eleCommendIcon from "@/components/commend_icon";
import { commonUtils } from "@/common/js/utils";
import dateFormat from "@/common/js/dateFormat";
export default {
  mixins: [commonUtils],
  props: {
    dataList: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {};
  },
  methods: {
    imgLoad() {
      this.__BsRefresh("BsApp", 300);
    },
  },
  updated() {
    this.__BsRefresh("BsApp", 300);
  },
  filters: {
    dateFormat(v) {
      return dateFormat("YYYY-mm-dd HH:MM:SS", new Date(v));
    },
  },
  components: {
    // star组件
    eleStar,
    // 用户评价图标
    eleCommendIcon,
  },
};
</script>

<style>
.ele-evaluate-container {
  position: relative;
}
.ele-evaluate-container::after {
  position: absolute;
  top: 0;
  width: 100%;
  height: 1px;
  transform: scaleY(0.6);
  background-color: rgba(7, 17, 27, 0.4);
}
.ele-evaluate-item {
  display: flex;
  margin: 0 18px;
  padding: 18px 0;
}
.header-img {
  width: 28px;
  height: 28px;
  overflow: hidden;
  border-radius: 50%;
}
.header-img img {
  height: 100%;
  width: 100%;
}

.ele-eval-content {
  margin-left: 12px;
  flex: 1;
}
.username {
  font-size: 10px;
  line-height: 12px;
  color: rgb(7, 17, 27);
}
.user-star {
  margin-top: 4px;
}
.user-commend-text {
  margin-top: 8px;
  font-size: 12px;
  line-height: 18px;
  color: rgb(7, 17, 27);
}
.publish-time {
  color: rgb(147, 153, 159);
  font-size: 10px;
  line-height: 12px;
}
.deliveryTime {
  font-size: 10px;
  line-height: 12px;
  color: rgb(147, 153, 159);
}
.user-commend-tag {
  display: flex;
  margin-top: 8px;
}
.commend-tag span {
  font-size: 9px;
  padding: 0 6px;
  margin-left: 8px;
  margin-top: 1px;
  line-height: 16px;
  display: inline-block;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: rgb(147, 153, 159);
  background-color: white;
  border: 1px solid rgba(7, 17, 27, 0.1);
}
/* star */
.ele-eval-content .user-star .ele-stars-item {
  height: 13px !important;
  width: 13px !important;
}
</style>
